package com.aspose.cells;

import java.util.ArrayList;
import java.util.HashMap;

class zcch {
   static void a(WorksheetCollection var0, HashMap var1, zbtz var2, byte[] var3, int var4) throws Exception {
      boolean var5 = (var3[var4] & 255 & 1) != 0;
      boolean var6 = (var3[var4] & 255 & 2) != 0;
      ++var4;
      int[] var7 = new int[]{var4};
      var2.a(a(var3, var7));
      var4 = var7[0];
      if (var5) {
         int var8 = com.aspose.cells.b.a.zc.a(var3, var4);
         var4 += 4;
         boolean var9 = false;
         boolean var10 = false;
         boolean var11 = false;
         int var12 = var4;

         for(int var13 = 0; var13 < var8; ++var13) {
            int var17 = com.aspose.cells.b.a.zc.e(var3, var12) & '\uffff';
            int var16;
            if (var12 + 4 != var3.length) {
               var16 = com.aspose.cells.b.a.zc.e(var3, var12 + 4) & '\uffff';
            } else {
               var16 = var2.i().length();
            }

            FontSetting var14 = var2.a(var17, var16 - var17);
            int var15 = com.aspose.cells.b.a.zc.e(var3, var12 + 2) & '\uffff';
            if (var15 < var1.size()) {
               var15 = (Integer)var1.get(var15);
               var14.getFont().c(var0.j(var15));
            }

            var12 += 4;
         }
      }

   }

   static CellArea a(byte[] var0, int var1) {
      CellArea var2 = new CellArea();
      var2.StartRow = com.aspose.cells.b.a.zc.a(var0, var1);
      var2.EndRow = com.aspose.cells.b.a.zc.a(var0, var1 + 4);
      var2.StartColumn = com.aspose.cells.b.a.zc.a(var0, var1 + 8);
      var2.EndColumn = com.aspose.cells.b.a.zc.a(var0, var1 + 12);
      return var2;
   }

   static ArrayList b(byte[] var0, int var1) {
      int var3 = com.aspose.cells.b.a.zc.a(var0, var1);
      ArrayList var4 = new ArrayList();
      int var2 = var1 + 4;

      for(int var5 = 0; var5 < var3 && var2 < var0.length; ++var5) {
         CellArea var6 = new CellArea();
         var6.StartRow = com.aspose.cells.b.a.zc.a(var0, var2);
         var6.EndRow = com.aspose.cells.b.a.zc.a(var0, var2 + 4);
         var6.StartColumn = com.aspose.cells.b.a.zc.a(var0, var2 + 8);
         var6.EndColumn = com.aspose.cells.b.a.zc.a(var0, var2 + 12);
         com.aspose.cells.b.a.a.ze.a(var4, (Object)var6);
         var2 += 16;
      }

      return var4;
   }

   static void a(ArrayList var0, byte[] var1, int var2) {
      if (var0 != null && var0.size() != 0) {
         System.arraycopy(com.aspose.cells.b.a.zc.a(var0.size()), 0, var1, var2, 4);
         int var3 = var2 + 4;

         for(int var4 = 0; var4 < var0.size(); ++var4) {
            CellArea var5 = (CellArea)var0.get(var4);
            System.arraycopy(com.aspose.cells.b.a.zc.a(var5.StartRow), 0, var1, var3, 4);
            System.arraycopy(com.aspose.cells.b.a.zc.a(var5.EndRow), 0, var1, var3 + 4, 4);
            System.arraycopy(com.aspose.cells.b.a.zc.a(var5.StartColumn), 0, var1, var3 + 8, 4);
            System.arraycopy(com.aspose.cells.b.a.zc.a(var5.EndColumn), 0, var1, var3 + 12, 4);
            var3 += 16;
         }

      } else {
         System.arraycopy(com.aspose.cells.b.a.zc.a((int)-1), 0, var1, var2, 4);
      }
   }

   static void a(CellArea var0, byte[] var1, int var2) {
      System.arraycopy(com.aspose.cells.b.a.zc.a(var0.StartRow), 0, var1, var2, 4);
      System.arraycopy(com.aspose.cells.b.a.zc.a(var0.EndRow), 0, var1, var2 + 4, 4);
      System.arraycopy(com.aspose.cells.b.a.zc.a(var0.StartColumn), 0, var1, var2 + 8, 4);
      System.arraycopy(com.aspose.cells.b.a.zc.a(var0.EndColumn), 0, var1, var2 + 12, 4);
   }

   static String a(byte[] var0, int[] var1) throws Exception {
      if (var1[0] >= var0.length) {
         return null;
      } else {
         int var2 = com.aspose.cells.b.a.zc.a(var0, var1[0]);
         var1[0] += 4;
         if (var2 < 0) {
            return null;
         } else if (var2 == 0) {
            return "";
         } else {
            String var3 = Encoding.getUnicode().a(var0, var1[0], var2 * 2);
            var1[0] += var2 * 2;
            return var3;
         }
      }
   }

   static DateTime c(byte[] var0, int var1) throws Exception {
      int var2 = com.aspose.cells.b.a.zc.e(var0, 0 + var1) & '\uffff';
      int var3 = com.aspose.cells.b.a.zc.e(var0, 2 + var1) & '\uffff';
      byte var4 = var0[4 + var1];
      new DateTime(1900, 1, 1);
      DateTime var5;
      if (var4 == 0) {
         var5 = new DateTime(var2, var3, 1);
      } else {
         var5 = new DateTime(var2, var3, var0[4 + var1] & 255, var0[5 + var1] & 255, var0[6 + var1] & 255, var0[7 + var1] & 255);
      }

      return var5;
   }

   static int a(byte[] var0, int var1, String var2) throws Exception {
      int var3 = var1;
      int var4;
      if (var2 == null) {
         for(var4 = 0; var4 < 4; ++var4) {
            var0[var3++] = -1;
         }
      } else if (var2.length() == 0) {
         for(var4 = 0; var4 < 4; ++var4) {
            var0[var3++] = 0;
         }
      } else {
         System.arraycopy(com.aspose.cells.b.a.zc.a(var2.length()), 0, var0, var1, 4);
         var3 = var1 + 4;
         byte[] var5 = Encoding.getUnicode().a(var2);
         System.arraycopy(var5, 0, var0, var3, var5.length);
         var3 += var5.length;
      }

      return var3;
   }

   static String d(byte[] var0, int var1) throws Exception {
      int var2 = com.aspose.cells.b.a.zc.a(var0, var1);
      var1 += 4;
      if (var2 < 0) {
         return null;
      } else {
         return var2 == 0 ? "" : Encoding.getUnicode().a(var0, var1, var2 * 2);
      }
   }

   static String e(byte[] var0, int var1) throws Exception {
      short var2 = com.aspose.cells.b.a.zc.b(var0, var1);
      var1 += 2;
      if (var2 < 0) {
         return null;
      } else {
         return var2 == 0 ? "" : Encoding.getUnicode().a(var0, var1, var2 * 2);
      }
   }
}
